﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Shrestha.Charts.Graph;

namespace Shrestha.Charts.Commands
{
    class FilterCommand : ICommand
    {
        private IViewModel _vm { get; set; }
        public FilterCommand(IViewModel cwvm)
        {
            this._vm = cwvm;
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            TriGraphFilter tgf = new TriGraphFilter(this._vm);
            tgf.ShowDialog();
            _vm.SetCondition(tgf.GetFilterString());
            _vm.Filter();
        }
    }
}

